import xFetch from './xFetch';

export async function colBindDic(bind) {
  return xFetch('/api/dic/colBindDic', {
    method: 'POST',
    body: JSON.stringify(bind),
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json',
    }
  })
}

export async function getItems(id) {
  return xFetch('/api/dic/' + id + '/items', {
    method: 'GET',
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json',
    }
  }).then(function (res) {
    return res.json();
  })
}

export async function getDic(id) {
  return xFetch('/api/dic/' + id, {
    method: 'GET',
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json',
    }
  }).then(function (res) {
    return res.json();
  })
}

export async function getDicList() {
  return xFetch('/api/dic/list', {
    method: 'GET',
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json',
    }
  }).then(function (res) {
    return res.json();
  })
}


